#include "test_user_module.h"

class TestTestUserModule : public TestUserModule {
public:
    TestTestUserModule() { printf("%s\n", __func__); }
    virtual ~TestTestUserModule() { printf("%s\n", __func__); }

    virtual int Test() { return -3; }
};

int main()
{
    printf("1 ------------\n");
    auto tum = SingletonContainer::Get<TestUserModule>();

    printf("2 ------------\n");
    if (tum != nullptr) {
        printf("main: %d\n", tum->Test());
    } else {
        printf("main: nullptr\n");
    }

    printf("3 ------------\n");
    std::shared_ptr<TestUserModule> ttum = std::make_shared<TestTestUserModule>();
    SingletonContainer::GetInstance()->SetSingleton("TestUserModule", ttum);

    printf("4 ------------\n");
    tum = SingletonContainer::Get<TestUserModule>();

    printf("5 ------------\n");
    if (tum != nullptr) {
        printf("main: %d\n", tum->Test());
    } else {
        printf("main: nullptr\n");
    }
    return 0;
}
